package com.loongtech.bi.entity.core;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.MappedSuperclass;

import com.loongtech.bi.support.chart.ChartData1;
import com.loongtech.bi.support.chart.ChartFlow;
import com.loongtech.bi.support.chart.ChartSelect;
import com.loongtech.core.gen.GenInnerK;

/**
 * 数据库实体基类，方便页面使用，实现统一接口
 * @author xckuang
 * @date 2015年02月07日
 */
@IdClass(KeyDateChannelLocationAndServerId.class)
@MappedSuperclass
@GenInnerK
public class EntityLocationChannelServer implements Serializable,ILocationInfo,IChannelInfo,IServerInfo
{
	private static final long	serialVersionUID	= 2L;
	
	@Id
	@Column(length=64, nullable = false)
	@ChartFlow(name="日期")
	protected String	date;		// 日期标识格式 yyyy-MM-dd
	@Id
	@Column(length=64, nullable = false)
	protected String	locationId; // 区域标识
	@Id
	@Column(length=64, nullable = false)
	protected String	channelId; // 渠道Id
	@Id
	@Column(length=64, nullable = false)
	protected String	serverId;	// 服务器标识
	@ChartSelect(name="数量", key = 1)
	@ChartData1(name="数量", key = 1)
	@Column(columnDefinition="bigint(20) NOT NULL default 0")
	protected long	num;			// 数目,为了支持金额，统一使用long类型

	public String getDate()
	{
		return date;
	}

	public void setDate(String date)
	{
		this.date = date;
	}

	public String getLocationId()
	{
		return locationId;
	}

	public void setLocationId(String locationId)
	{
		this.locationId = locationId;
	}

	public String getChannelId()
	{
		return channelId;
	}

	public void setChannelId(String channelId)
	{
		this.channelId = channelId;
	}

	public long getNum()
	{
		return num;
	}

	public void setNum(long num)
	{
		this.num = num;
	}

	public String getServerId()
	{
		return serverId;
	}

	public void setServerId(String serverId)
	{
		this.serverId = serverId;
	}

	public static class K {
		public static final String date = "date";
		public static final String locationId = "locationId";
		public static final String channelId = "channelId";
		public static final String serverId = "serverId";
		public static final String num = "num";
		
		//date, locationId, channelId, serverId, num, 
		public static java.util.List<String> toList() {
			java.util.List<String> list = new java.util.ArrayList<>();
			list.add(date);
			list.add(locationId);
			list.add(channelId);
			list.add(serverId);
			list.add(num);
			return list;
		}
	}
}